<h1><span></span><?= lang('label_your_advertise') ?></h1>

<ul class="breadcrumb">
    <li><a href="<?= base_url() ?>"><?= lang('label_home') ?></a></li>
    <li><a href="<?= base_url('user/profile') ?>"><?= lang('label_profile') ?></a></li>
    <li><?= lang('label_menu_link_advertise'); ?></li>
</ul>


<div class="page">
    <?php $this->load->view('template/default/user/top') ?>

    <div style="overflow:hidden;">
        <?php $this->load->view('template/default/user/side') ?>
        <div class="profile_page">
        <?php if ($result) { ?>
            <table id="tablestyle">
                <thead>
                    <tr class="head-row">
                        <th><?= lang('label_image') ?></th>
                        <th><?= lang('label_adv_show_type') ?></th>
                        <th><?= lang('label_invoices_id') ?></th>
                        <th><?= lang('label_views_num') ?></th>
                        <th><?= lang('label_clicks_num') ?></th>
                        <th><?= lang('label_created_date') ?></th>
                    </tr>
                </thead>
                <tbody>
                    <?php
                    foreach ($result as $value) {
                        ?>
                        <tr class="row" <?php if ($value->active == 'NO') { ?> style="background-color: #f7e4e4;" <?php } ?>>
                            <td><a href="<?= $value->url ?>" target="_blank"><img src="<?= base_url(ADS_PATH . "/$value->image") ?>" style="width: 150px;height: 150px" /></a></td>
                            <td><?= ($value->max_click != '0') ? lang('label_adv_click') . " ( $value->max_click)" : lang('label_adv_view') . " ( $value->max_view)"; ?></td>
                            <td><?php if ($value->inv_num) { ?>
                                <a target="_blank" href="<?= base_url("invoicies/show/$value->inv_num") ?>" ><?= $value->inv_num ?></a>
                                <?php } ?>
                            </td>
                            <td><?= $value->view ?></td>
                            <td><?= $value->click ?></td>
                            <td><?= timespan($value->create_date) ?> </td>
                        </tr>
                    <? } ?>
                </tbody>
            </table>
        <?php } else { ?>
            <div class="unsaved">
                <img src="<?php echo str_replace('/index.php', '', $_SERVER['SCRIPT_NAME']) ?>/<?php echo APPPATH ?>views/<?php echo $this->themes->Cms_themes() ?>/images/unsaved.png" alt="" />
                <br /><?= lang('message_no_advertise_found') ?>
            </div>
            <br /><br /><br /><br />
        <?php } ?>
        <div class="submit">
            <a href="<?= base_url('advertise/add') ?>" ><?= lang('label_add') ?></a>
        </div>
    </div>
    </div>
</div>